#include "heartbtimer.h"
#include <QTimerEvent>

HeartBTimer::HeartBTimer(QObject *parent){
    m_nTimerID = this->startTimer(1000);
}

HeartBTimer::~HeartBTimer(){
    killTimer(m_nTimerID);
}

void HeartBTimer::timerEvent(QTimerEvent *event){
    if(event->timerId() == m_nTimerID){
        handlerTimeout();
    }
}

void HeartBTimer::handlerTimeout(){
    TransMsg trans_msg;
    CreateReqHeartbMsg(trans_msg, msgthread->GetName().c_str());
    send(send_client, (char *)&trans_msg, sizeof(TransMsg), 0);
}
